package main

import (
	"fmt"
	"time"

	workerpool "github.com/robin/workerpool"
)

func main() {
	p := workerpool.New(5)

	for i := 0; i < 10; i++ {
		err := p.Schedule(func() {
			time.Sleep(3 * time.Second)
		})

		if err != nil {
			fmt.Println("task:", i, "err:", err)
		}
	}

	p.Free()

	fmt.Println("demo app exit")

}
